package com.example.admin.sizeyunsuan;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;

import java.util.Random;

/**
 * Created by admin on 2017/9/28.
 */

public class FunctionActivity extends AppCompatActivity {
    TextView tv1,tv2,tv3,tv4,tv5,tv6,tv7,tv8,tv9,tv10;
    int s1,s2,f;
    double s3;
    String[] jieguo,timu;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_function);
        tv1 = (TextView)findViewById(R.id.tv1);
        tv2 = (TextView)findViewById(R.id.tv2);
        tv3 = (TextView)findViewById(R.id.tv3);
        tv4 = (TextView)findViewById(R.id.tv4);
        tv5 = (TextView)findViewById(R.id.tv5);
        tv6 = (TextView)findViewById(R.id.tv6);
        tv7 = (TextView)findViewById(R.id.tv7);
        tv8 = (TextView)findViewById(R.id.tv8);
        tv9 = (TextView)findViewById(R.id.tv9);
        tv10 = (TextView)findViewById(R.id.tv10);

        jieguo = new String[10];
        timu = new String[10];

        Num a = new Num();
        f = a.fu();
        if(f == 1){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 + s2;
            timu[0] = s1 + "+" +s2;
            jieguo[0] = Double.toString(s3);
        }else if(f == 2){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 - s2;
            timu[0] = s1 + "-" +s2;
            jieguo[0] = Double.toString(s3);
        }else if(f == 3){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 * s2;
            timu[0] = s1 + "*" +s2;
            jieguo[0] = Double.toString(s3);
        }else if(f == 4){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 / s2;
            timu[0] = s1 + "/" +s2;
            jieguo[0] = Double.toString(s3);
        }f = a.fu();
        if(f == 1){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 + s2;
            timu[1] = s1 + "+" +s2;
            jieguo[1] = Double.toString(s3);
        }else if(f == 2){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 - s2;
            timu[1] = s1 + "-" +s2;
            jieguo[1] = Double.toString(s3);
        }else if(f == 3){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 * s2;
            timu[1] = s1 + "*" +s2;
            jieguo[1] = Double.toString(s3);
        }else if(f == 4){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 / s2;
            timu[1] = s1 + "/" +s2;
            jieguo[1] = Double.toString(s3);
        }
        f = a.fu();
        if(f == 1){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 + s2;
            timu[2] = s1 + "+" +s2;
            jieguo[2] = Double.toString(s3);
        }else if(f == 2){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 - s2;
            timu[2] = s1 + "-" +s2;
            jieguo[2] = Double.toString(s3);
        }else if(f == 3){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 * s2;
            timu[2] = s1 + "*" +s2;
            jieguo[2] = Double.toString(s3);
        }else if(f == 4){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 / s2;
            timu[2] = s1 + "/" +s2;
            jieguo[2] = Double.toString(s3);
        }
        f = a.fu();
        if(f == 1){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 + s2;
            timu[3] = s1 + "+" +s2;
            jieguo[3] = Double.toString(s3);
        }else if(f == 2){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 - s2;
            timu[3] = s1 + "-" +s2;
            jieguo[3] = Double.toString(s3);
        }else if(f == 3){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 * s2;
            timu[3] = s1 + "*" +s2;
            jieguo[3] = Double.toString(s3);
        }else if(f == 4){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 / s2;
            timu[3] = s1 + "/" +s2;
            jieguo[3] = Double.toString(s3);
        }
        f = a.fu();
        if(f == 1){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 + s2;
            timu[4] = s1 + "+" +s2;
            jieguo[4] = Double.toString(s3);
        }else if(f == 2){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 - s2;
            timu[4] = s1 + "-" +s2;
            jieguo[4] = Double.toString(s3);
        }else if(f == 3){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 * s2;
            timu[4] = s1 + "*" +s2;
            jieguo[4] = Double.toString(s3);
        }else if(f == 4){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 / s2;
            timu[4] = s1 + "/" +s2;
            jieguo[4] = Double.toString(s3);
        }
        f = a.fu();
        if(f == 1){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 + s2;
            timu[5] = s1 + "+" +s2;
            jieguo[5] = Double.toString(s3);
        }else if(f == 2){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 - s2;
            timu[5] = s1 + "-" +s2;
            jieguo[5] = Double.toString(s3);
        }else if(f == 3){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 * s2;
            timu[5] = s1 + "*" +s2;
            jieguo[5] = Double.toString(s3);
        }else if(f == 4){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 / s2;
            timu[5] = s1 + "/" +s2;
            jieguo[5] = Double.toString(s3);
        }
        f = a.fu();
        if(f == 1){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 + s2;
            timu[6] = s1 + "+" +s2;
            jieguo[6] = Double.toString(s3);
        }else if(f == 2){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 - s2;
            timu[6] = s1 + "-" +s2;
            jieguo[6] = Double.toString(s3);
        }else if(f == 3){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 * s2;
            timu[6] = s1 + "*" +s2;
            jieguo[6] = Double.toString(s3);
        }else if(f == 4){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 / s2;
            timu[6] = s1 + "/" +s2;
            jieguo[6] = Double.toString(s3);
        }
        f = a.fu();
        if(f == 1){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 + s2;
            timu[7] = s1 + "+" +s2;
            jieguo[7] = Double.toString(s3);
        }else if(f == 2){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 - s2;
            timu[7] = s1 + "-" +s2;
            jieguo[7] = Double.toString(s3);
        }else if(f == 3){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 * s2;
            timu[7] = s1 + "*" +s2;
            jieguo[7] = Double.toString(s3);
        }else if(f == 4){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 / s2;
            timu[7] = s1 + "/" +s2;
            jieguo[7] = Double.toString(s3);
        }
        f = a.fu();
        if(f == 1){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 + s2;
            timu[8] = s1 + "+" +s2;
            jieguo[8] = Double.toString(s3);
        }else if(f == 2){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 - s2;
            timu[8] = s1 + "-" +s2;
            jieguo[8] = Double.toString(s3);
        }else if(f == 3){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 * s2;
            timu[8] = s1 + "*" +s2;
            jieguo[8] = Double.toString(s3);
        }else if(f == 4){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 / s2;
            timu[8] = s1 + "/" +s2;
            jieguo[8] = Double.toString(s3);
        }
        f = a.fu();
        if(f == 1){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 + s2;
            timu[9] = s1 + "+" +s2;
            jieguo[9] = Double.toString(s3);
        }else if(f == 2){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 - s2;
            timu[9] = s1 + "-" +s2;
            jieguo[9] = Double.toString(s3);
        }else if(f == 3){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 * s2;
            timu[9] = s1 + "*" +s2;
            jieguo[9] = Double.toString(s3);
        }else if(f == 4){
            s1 = a.shu();
            s2 = a.shu();
            s3 = s1 / s2;
            timu[9] = s1 + "/" +s2;
            jieguo[9] = Double.toString(s3);
        }
        tv1.setText(timu[0]);
        tv2.setText(timu[1]);
        tv3.setText(timu[2]);
        tv4.setText(timu[3]);
        tv5.setText(timu[4]);
        tv6.setText(timu[5]);
        tv7.setText(timu[6]);
        tv8.setText(timu[7]);
        tv9.setText(timu[8]);
        tv10.setText(timu[9]);



    }
}
